
<template>
  <!-- 工作流 -->
  <div class="gzl">
    <div class="search">
      <hy-search
        class="search_box"
        ref="query"
        :searchTitle="searchTitle"
        v-model="searcher"
        :button="{btnShowBy3:true}"
        :buttonText="{btnNameBy3:'新建工作流'}"
        :col="6"
        @search="getlist(0)"
        @clickbybtn3="addworkflow()"
      ></hy-search>
    </div>
    <el-table class="table" stripe :data="tableData" style="width: 100%" height="580">
      <el-table-column type="index" label="序号" align="center" width="70"></el-table-column>
      <el-table-column prop="createOnStr" label="日期" align="center"></el-table-column>
      <el-table-column prop="comapnyName" label="合作公司" align="center"></el-table-column>
      <el-table-column prop="FinshTime" label="完成时间" align="center"></el-table-column>
      <el-table-column prop="Price" label="金额（元）" align="center">
        <template slot-scope="scope">{{scope.row.Price}}元</template>
      </el-table-column>
      <el-table-column prop="state" label="状态" align="center"></el-table-column>
      <el-table-column label="操作" align="center">
        <template slot-scope="scope">
          <el-button
            size="small"
            type="warning"
            @click="workflowxq(scope.row.id,0)"
            v-show="scope.row.paixu==1"
          >审核</el-button>
          <el-button size="small" type="primary" @click="workflowxq(scope.row.id,1)">详情</el-button>
        </template>
      </el-table-column>
    </el-table>
    <div class="pgnt">
      <el-pagination
        background
        layout="prev, pager, next"
        :current-page="current"
        :page-size="pagesize"
        @current-change="handleCurrentChange"
        :total="total"
      ></el-pagination>
    </div>
  </div>
</template>

<script>
import axios from 'axios'
export default {
  data () {
    return {
      searchTitle: [
        {
          type: "input",
          name: "customProductName",
          label: "输入搜索",
          placeholder: "请输入培训主题",
          prop: "customProductName"
        },
        {
          type: "date2",
          name: "issuanceDate",
          label: "输入时间",
          placeholder: "请选择输入时间",
          prop: "issuanceDate"
        }
      ],
      searcher: {
        customProductName: "",
        customProductNo: "",
        issuanceDate: ""
      },
      tableData: [],
      total: 1,
      current: 1,
      pagesize: 10,
    }
  },
  created () {
    this.getData(0)
  },
  methods: {
    getData (page) {
      let start = ""; let end = "";
      if (this.searcher.issuanceDate != null && this.searcher.issuanceDate != "") { start = this.searcher.issuanceDate[0]; end = this.searcher.issuanceDate[1]; }
      let obj = {
        creater: this.creater,
        key: this.searcher.customProductName ? this.searcher.customProductName : "",
        start: start,
        end: end,
        pn: page,
        PerPageSize: this.pagesize
      };
      var objs = JSON.stringify(obj);
      let the = { index: 6, jsondata: objs }
      axios.post("/apis/CEOManage.asmx/GetData", the).then(({ data }) => {
        var list = eval('(' + data.d + ')');
        this.total = list.count;
        this.tableData = list.data;
      });
    },
    addworkflow () {
      this.$router.push({ path: './AddWorkflow', query: { e: 0, shows: 0 } })
    },
    workflowxq (e, shows) {
      this.$router.push({ path: './AddWorkflow', query: { e: e, shows: shows } })
    },
    // 分页
    handleCurrentChange (e) {
      this.getData(e - 1)
    },
    // 日期改变
    chage (e) {
      console.log(e)
      if (e) {
        this.start =
          e[0].getFullYear() +
          '-' +
          (e[0].getMonth() + 1) +
          '-' +
          e[0].getDate()
        this.end =
          e[1].getFullYear() +
          '-' +
          (e[1].getMonth() + 1) +
          '-' +
          e[1].getDate()
      } else {
        this.start = ''
        this.end = ''
      }
    },
    // 筛选
    onsubmit () {
      this.getData(0)
    }
  }
}
</script>

<style lang="scss" scoped>
.gzl {
  padding-left: 10px;
  padding-right: 10px;
  padding-top: 10px;
}

.table {
  margin-bottom: 20px;
}
.pgnt {
  text-align: center;
}
.demo-form-inline {
  display: inline-block;
}
.search {
  height: 50px;
  border-radius: 5px;
  background-color: #fff;
  padding-left: 20px;
  padding-top: 10px;
  margin-bottom: 20px;
}
.ebtn {
  float: right;
  margin-right: 20px;
}
</style>
